<template>
  <div class="search">
    <f-form ref="form" :action="api.bvs" :form-key="this.formItem.vipcardServerId" >
      <f-form-item label="卡种Id"  name="vipcardId" dataType="${formField.dataType}"   :value="formItem.vipcardId" />
      <f-form-item label="服务Id"  name="serverId" dataType="${formField.dataType}"   :value="formItem.serverId" />
      <f-form-item label="服务描述"  name="serverDesc" dataType="${formField.dataType}"   :value="formItem.serverDesc" />
      <f-form-item label="有效期"  name="validDay" dataType="${formField.dataType}"   :value="formItem.validDay" />
      <f-form-item label="有效期"  name="validDayType" dataType="number"   :value="formItem.validDayType" />
      <f-form-item label="值"  name="serverValue" dataType="${formField.dataType}"   :value="formItem.serverValue" />
      <f-form-item label="数值类型"  name="numType" dataType="number"   :value="formItem.numType" />
      <f-form-item label="计费方式（1期间卡 2计次卡）"  name="billingWay" dataType="number"   :value="formItem.billingWay" />
      <f-form-item label=""  name="isSet" dataType="number"   :value="formItem.isSet" />
      <f-form-item label="排序"  name="serverSort" dataType="number"   :value="formItem.serverSort" />
      <f-form-item label="是否删除"  name="deleted" dataType="number"   :value="formItem.deleted" />
      <f-form-item label="更新人"  name="updateUser" dataType="${formField.dataType}"   :value="formItem.updateUser" />
      <f-form-item label="更新时间"  name="updateTime" dataType="${formField.dataType}"   :value="formItem.updateTime" />
      <f-form-item label="创建人"  name="createUser" dataType="${formField.dataType}"   :value="formItem.createUser" />
      <f-form-item label="创建时间"  name="createTime" dataType="${formField.dataType}"   :value="formItem.createTime" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'bvsForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          vipcardServerId: '',
          vipcardId: '',
          serverId: '',
          serverDesc: '',
          validDay: '',
          validDayType: '',
          serverValue: '',
          numType: '',
          billingWay: '',
          isSet: '',
          serverSort: '',
          deleted: '',
          updateUser: '',
          updateTime: '',
          createUser: '',
          createTime: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.vipcardServerId) {
          let params={
              vipcardServerId:data.vipcardServerId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
